<template>
  <div class="p-20 h_full userbox flexcolumn">
    <div class="flexbetween useritem">
      <img
        src="//wework.qpic.cn/wwpic3az/646139_qhEaA8U0R8ya8Uz_1702871041/0"
        alt=""
        class="imgbox"
      />
      <div class="flex11">
        <div class="w_full textover c_text2 f-14 mb-6">小姐姐</div>
        <div class="w_full textover c_f90 f-12">@执行</div>
      </div>
      <el-button size="mini" icon="el-icon-refresh-right" class="reflushbtn"
        >刷新</el-button
      >
    </div>
    <el-form ref="form" :model="form" label-width="80px" label-position="left">
      <div class="baseinfobox bg_f7f7f7 p-12">
        <el-form-item label="备注：">
          <i
            v-if="!show1"
            class="el-icon-edit c_primary commhover f-15"
            @click="handShow(1)"
          ></i>
          <el-input
            v-else
            ref="show1"
            v-model="form.name"
            maxlength="20"
            @blur="handleBlur(1)"
            size="small"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="称呼：">
          <i
            v-if="!show2"
            class="el-icon-edit c_primary commhover f-15"
            @click="handShow(2)"
          ></i>
          <el-input
            v-else
            ref="show2"
            v-model="form.name"
            maxlength="20"
            @blur="handleBlur(2)"
            size="small"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="来源：">
          <span class="f-14 c_text2">通过微信好友添加</span>
        </el-form-item>
        <el-form-item label="添加时间:">
          <span class="f-14 c_text2">2024-01-06 11:19</span>
        </el-form-item>
        <el-form-item label="加入群聊:">
          <span class="f-14 c_text2"><span class="c_primary">1</span>个</span>
        </el-form-item>
        <el-form-item label="添加员工:">
          <span class="f-14 c_text2"><span class="c_primary">1</span>个</span>
        </el-form-item>
        <el-form-item label="企业：">
          <i
            v-if="!show3"
            class="el-icon-edit c_primary commhover f-15"
            @click="handShow(3)"
          ></i>
          <el-input
            v-else
            ref="show3"
            v-model="form.name"
            maxlength="20"
            @blur="handleBlur(3)"
            size="small"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="手机：">
          <i
            class="el-icon-edit c_primary commhover f-15"
            @click="handleOpenPhone"
          ></i>
        </el-form-item>
        <el-form-item label="描述：">
          <i
            v-if="!show4"
            class="el-icon-edit c_primary commhover f-15"
            @click="handShow(4)"
          ></i>
          <el-input
            v-else
            ref="show4"
            v-model="form.name"
            rows="5"
            type="textarea"
            maxlength="150"
            @blur="handleBlur(4)"
            size="small"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="行为轨迹:">
          <span class="c_primary commhover f-14" @click="handleOpenTrian"
            >查看</span
          >
        </el-form-item>
      </div>

      <label-box title="企微标签" :labelList='labelList' @open='handleLabelOpen' />
      
      <label-box title="智能标签" :labelList='labelList' @open='handleZnLabelOpen' />

      <div class="c_222333 f-14">客户备忘</div>
      <div class="baseinfobox bg_f7f7f7 p-12">
        <el-form-item label="" label-width="0">
          <el-input
            v-model="form.name"
            type="textarea"
            rows="5"
            maxlength="200"
            size="small"
          ></el-input>
        </el-form-item>
      </div>
    </el-form>
    <!-- 手机号 -->
    <EditPhone
      v-if="openphone"
      :visable="openphone"
      @close="handleClosePhone"
    />
    <!-- 行为轨迹 -->
    <BehaviorTrian
      v-if="opentrian"
      :visable="opentrian"
      @close="handleCloseTrian"
    />
    <!-- 企微标签 -->
    <edit-label
      v-if="openlabel"
      :visable="openlabel"
      @close="handleLabelClose"
    />
    <!-- 智能标签 -->
    <select-smart-tags v-if="openznlabel" :visableIf.sync="openznlabel" height='650px' />
  </div>
  <!--  -->
</template>

<script>
import EditPhone from "./EditPhone.vue";
import BehaviorTrian from "./BehaviorTrian.vue";
import EditLabel from './EditLabel.vue';
import LabelBox from './LabelBox.vue';
import SelectSmartTags from '@/views/customerOperationsMgt/customerMgt/selectSmartTags.vue';
export default {
  data() {
    return {
      form: {},
      show1: false,
      show2: false,
      show3: false,
      show4: false,
      openphone: false,
      opentrian: false,
      openlabel: false,
      openznlabel:false,
      labelList: ["中药",'一般'],
    };
  },
  components: {
    EditPhone,
    BehaviorTrian,
    EditLabel,
    LabelBox,
    SelectSmartTags
  },
  methods: {
    handShow(type) {
      this["show" + type] = true;
      this.$nextTick(() => {
        this.$refs["show" + type].focus();
      });
    },

    handleBlur(type) {
      this["show" + type] = false;
    },

    handleOpenPhone() {
      this.openphone = true;
    },

    handleClosePhone() {
      this.openphone = false;
    },

    handleOpenTrian() {
      this.opentrian = true;
    },

    handleCloseTrian() {
      this.opentrian = false;
    },

    handleLabelOpen() {
      this.openlabel = true;
    },

    handleLabelClose() {
      this.openlabel = false;
    },

    handleZnLabelOpen(){
      this.openznlabel = true
    },
  },
};
</script>
<style lang="scss" scoped>
.userbox {
  overflow: auto;
}
.useritem {
  .imgbox {
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border-radius: 4px;
  }
}
.reflushbtn {
  margin-left: 5px;
  margin-right: -10px;
}
.baseinfobox {
  margin: 20px 0;
  border-radius: 4px;
}
.el-form-item {
  margin-bottom: 0;
  ::v-deep .el-form-item__label {
    color: rgba(0, 0, 0, 0.45);
  }
}
</style>